# there are 2 estimates. I selected the ITT (not ATET).
# ArcNic2009 argue that GOTV work best for voters whose propensity to vote is close to 50%, a propensity which is itself determined by the salience of the election. They do not use a moderation analysis or subseting strategy, but instead  "assess this by plugging the estimates displayed in Table 2 into the normal probability distribution and graphing the mobilization effect along the voting propensity continuum for low- and high-salience elections." We treat all estimates as homogeneous and look at the overall effect.

source(here::here("code/load.R"))

here("data/meta_analyses_raw/ArcNic2009/tablea1_p14_ocr.csv") |>
  read_csv() |>
  pivot_longer(-City) |>
  pivot_wider(names_from = City, values_from = value) |>
  mutate(meta_id = "ArcNic2009",
         subfield = "AP",
         question = "Is the effectiveness of GOTV at stimulating participation among chronic nonvoters contingent on the electoral environment?",
         #the estimate will be the ITT effect
         numbers = str_extract_all(`Intent-to-Treat Effect`,
                                   "[+-]?[0-9]+([.][0-9]+)?")) |>
  unnest_wider(numbers, names_sep = "") |>
  rename(estimate = "numbers1",
         std.error = "numbers2") |>
  mutate(name = as.numeric(str_extract(name, "[0-9]+")),
         study_id = case_when(
           name == 1  ~ "Gerber and Green",
           name == 2 ~ "Green and Gerber",
           name >= 3 & name <=7 ~ "Green, Gerber, and Nickerson",
           name == 8 ~ "Michelson",
           name >= 9 & name <=10 ~ "Nickerson",
           name == 11  ~ "Arcenaux",
           TRUE ~ "NA")) |>
  select(meta_id,
         subfield,
         question,
         study_id,
         study_year = Year,
         estimate,
         std.error) |>
  write_csv(here("data/meta_analyses_clean/ArcNic2009.csv"))


